import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../data/models/prompt_model.dart';

/// 详情页面状态管理 - Detail Page State Management
/// 
/// 管理详情页面的所有状态数据
/// Manages all state data for the detail page
class DetailState {
  // 当前 Prompt - Current Prompt
  final Rx<PromptModel?> prompt = Rx<PromptModel?>(null);
  
  // 页面状态 - Page State
  final RxBool isLoading = false.obs;
  final RxBool isPreviewMode = false.obs;
  final RxBool isEditing = false.obs;
  final RxString error = ''.obs;
  
  // 内容控制器 - Content Controllers
  final TextEditingController contentController = TextEditingController();
  final ScrollController scrollController = ScrollController();
  
  // 变量输入状态 - Variable Input State
  final RxMap<String, String> variableValues = <String, String>{}.obs;
  final RxBool isVariableDialogOpen = false.obs;
  
  // 版本管理 - Version Management
  final RxList<String> versions = <String>[].obs;
  final RxString currentVersion = ''.obs;
  
  /// 版本数量 - Version count
  int getVersionCount() => versions.length;
  
  /// 释放资源 - Dispose resources
  void dispose() {
    contentController.dispose();
    scrollController.dispose();
  }
}